<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>欢迎登录后台管理系统</title>
<link href="__STATIC__/Admin/css/base.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/Admin/css/right.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/css/page.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="__STATIC__/js/jquery-2.1.1.min.js"></script>
<script>
$(document).ready(function(){
   $(function(){
      $('.rightinfo tbody tr:odd').css("backgroundColor","#f5f8fa");
   });

//   $(".imgact2").click(function(){
//	   var id=$(this).parent().find("input[name='id']").val();
//	   var img=($(this).attr("src")=='__STATIC__/Admin/image/no.gif') ? "__STATIC__/Admin/image/yes.gif":"__STATIC__/Admin/image/no.gif";
//	   $(this).attr("src",img);
//	 //处理
//   });
});
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li><a href="{:url('Index/center')}">首页</a></li>
    <li>用户</li>
  </ul>
</div>
<div class="rightinfo">
  <div class="tools"> 
    <ul class="toolbar">
      <li><a href="{:url('User/index',['yj'=>1])}"><span><img src="__STATIC__/Admin/image/ico03.png" /></span>佣金排行</a></li>
      <li><a href="{:url('User/index',['cz'=>1])}"><span><img src="__STATIC__/Admin/image/ico03.png" /></span>充值排行</a></li>
      <li><a href="{:url('User/index',['black'=>1])}"><span><img src="__STATIC__/Admin/image/t08.png" /></span>黑名单</a></li>
      <li style="background:#FFF; text-indent:1em; border:0">
          <form name="fsoso" method="post" action="{:url('User/index')}">
          用户ID：<input type="text" name="sci" class="dfinput" value="" style="width:200px" />
          <input name="submit" class="btn" value="查询" type="submit" >
          </form>
      </li>
    </ul>
  </div>
  <table class="tablelist">
    <thead>
      <tr>
        <th>ID</th>
        <th>Openid</th>
        <th>昵称</th>
        <th>头像</th>
        <th>竞猜记录</th>
        <th>线下成员</th>
        <th>支付(元)</th>
        <th>余额</th>
        <th>总佣金(元)</th>
        <th>已发佣金(元)</th>
        <th>未发佣金(元)</th>
        <th>开启代理</th>
        <th>佣金类型</th>
        <th>黑名单</th>
      </tr>
    </thead>
    <tbody>
    
    {volist name="list" id="vo"}
      <tr height="45" align="center">
        <td>{$vo['id']}</td>
        <td>{$vo['openid']}</td>
        <td>{$vo['nickname']}</td>
        <td><img src="{$vo['imgurl']}" height="54" width="54"/></td>
        <td><a href="{:url('jchistory?id='.$vo['id'])}" style="width:40px;height:40px;display:block;color:blue;">查看</a></td>
        <td><a href="{:url('tuijian?id='.$vo['id'])}" style="width:40px;height:40px;display:block;color:blue;">{$vo['tuijian']}</a></td>
        <td>{$vo['paynum']/100}</td>
          <td>{$vo['money']/100}</td>
        <td>{$vo['yongjin']/100}</td>
        <td>{$vo['com']/100}</td>
        <td>{$vo['can']/100}</td>
        <td>
            <input type="hidden" name="id" value="{$vo['id']}" />
            {if $vo['is_daili'] == 1}
            <img src="__STATIC__/Admin/image/yes.gif" style="cursor:pointer;vertical-align:middle" class="imgact1" />
            {else}
            <img src="__STATIC__/Admin/image/no.gif" style="cursor:pointer;vertical-align:middle" class="imgact1" />
            {/if}
        </td>
        <td>
            {if $vo['is_daili'] == 1}
            <input type="hidden" name="id" value="{$vo['id']}" />
            {if $vo['is_usedefault'] == 1}
            <a><img src="__STATIC__/Admin/image/yes.gif" style="cursor:pointer;vertical-align:middle" class="imgact3" />默认</a>
            <a><img src="__STATIC__/Admin/image/no.gif" style="cursor:pointer;vertical-align:middle" class="imgact4" />自定义</a>
            {else}
            <a><img src="__STATIC__/Admin/image/no.gif" style="cursor:pointer;vertical-align:middle" class="imgact3" />默认</a>
            <a><img src="__STATIC__/Admin/image/yes.gif" style="cursor:pointer;vertical-align:middle" class="imgact4" />自定义</a>
            {/if}
            {else}
            无
            {/if}
        </td>
        <td>
            <input type="hidden" name="id" value="{$vo['id']}" />
            {if $vo['is_black'] == 1}
            <img src="__STATIC__/Admin/image/yes.gif" style="cursor:pointer;vertical-align:middle" class="imgact2" />
            {else}
            <img src="__STATIC__/Admin/image/no.gif" style="cursor:pointer;vertical-align:middle" class="imgact2" />
            {/if}
        </td>
      </tr>
      {/volist}
    </tbody>
  </table>
</div>
<div class="pages">
  <a href="{:url('User/index')}">首页</a>
  {if($prepage>0)}
  <a href="{:url('User/index?page='.$prepage)}">上一页</a>
  {/if}
  
  {if($nextpage>0)}
  <a href="{:url('User/index?page='.$nextpage)}">下一页</a>
  {/if}
  
</div>
<div class="pages">
  {if($page)}
	<font>共{$page}条数据</font>
	{else}
	<font color='#ff0000'>暂无数据</font>
	{/if}
</div>
</body>

<!--js代码部分-->
<script>
    $(function () {
        //是否开启代理的自定义配置
        $(".imgact4").click(function () {
            var id = $(this).parent().siblings("input[name='id']").val();
           // if($(this).attr('src') == "__STATIC__/Admin/image/no.gif") {
                var img1 = "__STATIC__/Admin/image/yes.gif";
                var img2 = "__STATIC__/Admin/image/no.gif";
                $(this).attr('src',img1);
                var obj = $(this).parent().prev().find("img");
                obj.attr('src',img2);
                window.location.href = "user/id/"+id;//此处应跳转至配置页
                //开启默认设置
//                var flag = 2;
//                $.ajax({
//                    url:"{:url('User/defaultAgent')}",
//                    data:{id:id,flag:flag},
//                    typ:'POST',
//                    dataType:'json',
//                    success:function (data) {
//                        if(data.flag == 0) {
//
//                        }else {
//                            alert(data.msg);
//                        }
//                    }
//                });
           // }
        });
        //是否开启代理的默认配置
        $(".imgact3").click(function () {
            var id=$(this).parent().siblings("input[name='id']").val();
            if($(this).attr('src') == '__STATIC__/Admin/image/no.gif') {
                var img1 = "__STATIC__/Admin/image/yes.gif";
                var img2 = "__STATIC__/Admin/image/no.gif";
                $(this).attr('src',img1);
                var obj = $(this).parent().next().find("img");
                obj.attr('src',img2);
                //开启自定义设置
                var flag = 1;
                $.ajax({
                    url:"{:url('User/defaultAgent')}",
                    data:{id:id,flag:flag},
                    typ:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
//                            alert('设置成功');
                        }else {
                            alert(data.msg);
                        }
                    }
                });
            }
        });

      //是否开启代理
      $(".imgact1").click(function(){
            var id=$(this).parent().find("input[name='id']").val();
            if($(this).attr('src') == '__STATIC__/Admin/image/no.gif') {
                var img = "__STATIC__/Admin/image/yes.gif";
                $(this).attr('src',img);
                var flag = 1;
                $.ajax({
                    url:"{:url('User/agent')}",
                    data:{id:id,flag:flag},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.reload();
                        }else {
                            window.location.reload();
                        }
                    }
                });

            }else {
                var img = "__STATIC__/Admin/image/no.gif";
                $(this).attr('src',img);
                var flag = 2;
                $.ajax({
                    url:"{:url('User/agent')}",
                    data:{id:id,flag:flag},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.reload();
                        }else {
                            window.location.reload();
                        }
                    }
                });
            }
        });
      
      //是否加入黑名单
        $(".imgact2").click(function(){
            var id=$(this).parent().find("input[name='id']").val();
            if($(this).attr('src') == '__STATIC__/Admin/image/no.gif') {
                var img = "__STATIC__/Admin/image/yes.gif";
                $(this).attr('src',img);
                var flag = 1;
                $.ajax({
                    url:"{:url('User/forbid')}",
                    data:{id:id,flag:flag},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.reload();
                        }else {
                            window.location.reload();
                        }
                    }
                });

            }else {
                var img = "__STATIC__/Admin/image/no.gif";
                $(this).attr('src',img);
                var flag = 2;
                $.ajax({
                    url:"{:url('User/forbid')}",
                    data:{id:id,flag:flag},
                    type:'POST',
                    dataType:'json',
                    success:function (data) {
                        if(data.flag == 0) {
                            window.location.reload();
                        }else {
                            window.location.reload();
                        }
                    }
                });
            }
        });
    })
</script>
</html>